//
//  BottomMenuView.swift
//  MyTest
//
//  Created by guanzhongwang on 2021/5/9.
//

import UIKit

class BottomMenuView: UIView {

    init() {
        super.init(frame: CGRect.zero)
        let share = UIButton(type: .custom)
        share.contentEdgeInsets = UIEdgeInsets.init(top: 0, left: 10, bottom: 0, right: 10)
        share.setImage(UIImage(named: "share")?.reSizeImage(reSize: CGSize.init(width: 12, height: 12)), for: .normal)
        share.setTitle("   分享", for: .normal)
        share.setTitleColor(B000_COLOR, for: .normal)
        share.titleLabel?.font = Font_Size_12
        addSubview(share)
        share.snp.makeConstraints({
            $0.left.equalTo(15)
            $0.top.equalTo(5)
            $0.bottom.equalToSuperview().inset(10)
        })
        let comment = UIButton(type: .custom)
        comment.contentEdgeInsets = UIEdgeInsets.init(top: 0, left: 10, bottom: 0, right: 10)
        comment.setImage(UIImage(named: "comment")?.reSizeImage(reSize: CGSize.init(width: 12, height: 12)), for: .normal)
        comment.titleLabel?.font = Font_Size_12
        addSubview(comment)
        comment.setTitle("   201", for: .normal)
        comment.setTitleColor(B000_COLOR, for: .normal)
        comment.snp.makeConstraints({
            $0.centerY.equalTo(share)
            $0.left.equalTo(share.snp.right).offset(10)
        })
        let prise = UIButton(type: .custom)
        prise.contentEdgeInsets = UIEdgeInsets.init(top: 0, left: 10, bottom: 0, right: 10)
        prise.setImage(UIImage(named: "zan")?.reSizeImage(reSize: CGSize.init(width: 12, height: 12)), for: .normal)
        prise.titleLabel?.font = Font_Size_12
        addSubview(prise)
        prise.setTitle("   321", for: .normal)
        prise.setTitleColor(B000_COLOR, for: .normal)
        prise.snp.makeConstraints({
            $0.centerY.equalTo(share)
            $0.left.equalTo(comment.snp.right).offset(10)
        })
        let closebtn = UIButton(type: .custom)
        addSubview(closebtn)
        closebtn.contentEdgeInsets = UIEdgeInsets.init(top: 5, left: 10, bottom: 5, right: 0)
        var image = UIImage(named: "close")
        image = image?.scaleImage(scaleSize: 0.5)
        image = image?.withRenderingMode(.alwaysTemplate)
        closebtn.tintColor = .lightGray
        closebtn.setImage(image, for: .normal)
        closebtn.snp.makeConstraints({
            $0.right.equalToSuperview().inset(15)
            $0.centerY.equalToSuperview()
        })
        closebtn.addTarget(self, action: #selector(deleteCell(btn:)), for: .touchUpInside)
    }
    func updateContent(item:NewsModel) {
        
    }
    @objc func deleteCell(btn:UIButton){
        let frame = btn.convert(btn.frame, to: window)
        SystemLog(frame)
    }
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}
